package org.example;

public class PlayerData {
    private int systemHealth;
    private int completedChallenges;
    private int storyProgress;
    private String playerName;
    // 添加修复进度字段
    private int repairProgress;
    private int score;


    public PlayerData() {
        this.systemHealth = 30; // 初始低健康状态
        this.completedChallenges = 0;
        this.storyProgress = 0;
        this.playerName = "DefaultPlayer";
    }
    public void completeRepair() {
        repairProgress += 20;
        repairProgress = Math.min(repairProgress, 100);
    }

    public int getRepairProgress() {
        return repairProgress;
    }


    public void completeChallenge() {
        this.completedChallenges++;
        this.systemHealth = Math.min(100, systemHealth + 15); // 完成挑战恢复健康

        // 每完成3个挑战推进故事
        if(completedChallenges % 3 == 0) {
            this.storyProgress++;
        }
    }

    // Getters
    public int getSystemHealth() { return systemHealth; }
    public int getCompletedChallenges() { return completedChallenges; }
    public int getStoryProgress() { return storyProgress; }

    // 角色形象描述
    public String getCharacterDescription() {
        return "<html><div style='width:200px;color:white;'>" +
                "<b>数字幽灵</b><br>" +
                "健康度: " + systemHealth + "%<br>" +
                "完成挑战: " + completedChallenges + "<br>" +
                "故事进度: " + (storyProgress+1) + "/5" +
                "</div></html>";
    }

    public void saveGame() {
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }
}
